import qiniuUploader from "@/api/qiniuUploader.js"
import Vue from 'vue'
let getImgs = (tempFilePaths,qluToken,type = '.png') => {
	let arr = tempFilePaths.map( (val,index) => {
		let key = new Date().getTime()+'yyc'+index;
		return new Promise(function (resolve, reject) {
			qiniuUploader.upload(val, (rsp) => {
					resolve(rsp.imageURL);
				},
				(error) => {
					uni.hideLoading();
					uni.showToast({
						title:'上传失败',
						icon:none
					})
					console.log('error:' + error)
				}, {
					region: 'ESP',
					domain:'',
					// domain: 'http://furniturepic.sayyin.com/',
					// domain: this.url,
					key: key + (type || '.png'),
					uptoken: qluToken
				}
			 );
		})
	});
	return arr;
}

export default getImgs